package com.example.demo.mapper;

import com.example.demo.pojo.SelectWeb;
import com.example.demo.pojo.User;
import com.example.demo.pojo.Web;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user where uid=#{UID} and upsw=#{UPSW}")
    User getUser(User user);
    @Insert("insert into user(uid,uname,upsw,uphone,uemail) values (#{UID},#{UName},#{UPSW},#{UPhone},#{UEmail})")
    void AddUser(User user);

    @Update("update user set UID=#{UID},UName=#{UName},UEmail=#{UEmail},UPhone=#{UPhone},UPSW=#{UPSW},gender=#{gender},img=#{img} ")
    void userUpd(User user);

    @Select("select web_id, web_url, phishing, user_id, update_time from web order by update_time DESC ")
    List<Web> allWeb();
    @Insert("insert into web(web_url, phishing, user_id, update_time) values (#{webUrl},#{phishing},#{userId},now())")
    void addWeb(Web web);

    List<Web> selectWeb(SelectWeb selectWeb);

    @Select("select * from web where web_url=#{webUrl}")
    Web findWeb(Web web);
}
